package com.neusoft.bizcore.notice.notification.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractModel;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@Entity
@Table(name = "neuiot_notice_record")
public class NoticeRecord extends AbstractModel {
    private static final long serialVersionUID = -2375678914873828135L;

    /*** 创建时间 */
    @Column(nullable = false)
    private Date createTime = new Date();

    /** 通知发起应用 */
    @Length(max = 32, message = "应用编码不能超过{max}位")
    @Column(length = 32, nullable = true)
    private String appCode;

    @Length(max = 32, message = "主题不能超过{max}位")
    @Column(length = 32, nullable = true)
    private String title;

    @NotNull(message = "系统通知类型不能为空")
    @Column(length = 255, nullable = false)
    private String type;

    @OneToOne(cascade = {CascadeType.ALL }, fetch = FetchType.LAZY)
    private NoticeRecordMail mail;

    @OneToOne(cascade = {CascadeType.ALL }, fetch = FetchType.LAZY)
    private NoticeRecordSystem system;

}
